//
//  AIChooseCollectionCell.m
//  MiaMind
//
//  Created by Vill on 2023/12/12.
//

#import "AIChooseCollectionCell.h"

@interface AIChooseCollectionCell ()

@property (nonatomic, strong) UIView *containView;
@property (nonatomic, strong) UIImageView *iconImg;

@end

@implementation AIChooseCollectionCell

- (instancetype)initWithFrame:(CGRect)frame{
    if(self == [super initWithFrame:frame]){
        [self setUI];
    }
    return self;
}

- (void)setSelected:(BOOL)selected{
    if (selected){
        self.containView.layer.borderColor = UIColor.whiteColor.CGColor;
        self.containView.layer.shadowColor = [UIColor colorHex:@"#FFFFFF" alpha:0.68].CGColor;
    }else{
        self.containView.layer.borderColor = UIColor.clearColor.CGColor;
        self.containView.layer.shadowColor = [UIColor colorHex:@"#FFFFFF" alpha:0].CGColor;
    }
}

-(void)setUI{
    [self.contentView addSubview:self.containView];
    [self.containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.contentView);
    }];
    [self.containView addSubview:self.iconImg];
    [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.containView);
    }];
}

-(void)setSoulMateModel:(AISoulMateModel *)soulMateModel{
    _soulMateModel = soulMateModel;
    [self.iconImg sd_setImageWithURL:[NSURL URLWithString:soulMateModel.avatarUrl]];
}

- (UIView *)containView{
    if(!_containView){
        _containView = [UIView new];
        _containView.layer.cornerRadius = PTW(10);
        _containView.layer.masksToBounds = YES;
        _containView.layer.borderColor = UIColor.clearColor.CGColor;
        _containView.layer.borderWidth = PTW(2);
        _containView.layer.shadowColor = [UIColor colorHex:@"#FFFFFF" alpha:0].CGColor;
        _containView.layer.shadowOffset = CGSizeMake(0,0);
        _containView.layer.shadowOpacity = 1;
        _containView.layer.shadowRadius = 5;
    }
    return _containView;
}

- (UIImageView *)iconImg{
    if(!_iconImg){
        _iconImg = [UIImageView new];
        _iconImg.contentMode = UIViewContentModeScaleAspectFill;
        _iconImg.clipsToBounds = YES;
    }
    return _iconImg;
}


@end
